<template>
  <div class="anime-axios-loading">
    <div class="loading">
      <div class="el" style=" transform: rotate(0deg);"></div>
      <div class="el" style=" transform: rotate(45deg);"></div>
      <div class="el" style=" transform: rotate(90deg);"></div>
      <div class="el" style=" transform: rotate(135deg);"></div>
      <div class="el" style=" transform: rotate(180deg);"></div>
      <div class="el" style=" transform: rotate(225deg);"></div>
      <div class="el" style=" transform: rotate(270deg);"></div>
      <div class="el" style=" transform: rotate(315deg);"></div>
      <!-- <div class="progress"></div> -->
    </div>
  </div>
</template>
<script>
import $ from "jquery";
import anime from "animejs/lib/anime.es.js";
export default {
  name: "AniLoading",
  data() {
    return {};
  },
  mounted() {
    anime.timeline({
      direction: "normal",
      loop: true
    }).add({ targets: '.loading .el:nth-child(1)',  background: '#000' }, 100)
    .add({ targets: '.loading .el:nth-child(2)',  background: '#000' }, 200)
    .add({ targets: '.loading .el:nth-child(3)',  background: '#000' }, 300)
    .add({ targets: '.loading .el:nth-child(4)',  background: '#000' }, 400)
    .add({ targets: '.loading .el:nth-child(5)',  background: '#000' }, 500)
    .add({ targets: '.loading .el:nth-child(6)',  background: '#000' }, 600)
    .add({ targets: '.loading .el:nth-child(7)',  background: '#000' }, 700)
    .add({ targets: '.loading .el:nth-child(8)',  background: '#000' }, 800);
  },
  methods: {}
};
</script>
<style lang="scss" scoped>
.anime-axios-loading {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 200px;
  justify-content: center;
  align-items: center;
  background-color: white;
  .loading {
    position: relative;
    display: flex;
    width: 50px;
    height: 50px;
    .el{
      position: absolute;
      font-size: 20px;
      background-color: rgb(187, 187, 187);
      width: 10px;
      height: 10px;
      border-radius: 5px;
      top: 0px;
      left: 20px;
      transform-origin: 5px 25px;
    }
    .progress {
      position: absolute;
      width: 0px;
      height: 5px;
      top: 35px;
      left: 10px;
      background-color: black;
    }
  }
}
</style>